]> permondes.de Git - Analog_Engine.git/blame - scripts/Damped Harmonic Oscillator.AESL
Focus on potential fields
[Analog_Engine.git] / scripts / Damped Harmonic Oscillator.AESL
CommitLineData
2faffece
P
1IDENTIFICATION DIVISION
2PROGRAM-ID Damped_Oscillator
3
4ENVIRONMENT DIVISION
5ENGINE Anabrid-THAT
6REQUIRES COEFFICIENT 5
7REQUIRES INTEGRATOR 2
8REQUIRES INVERTER 1
9REQUIRES SUMMER 2
10
11DATA DIVISION
f25252dd 12OUTPUT OUTPUT.U y
6e8a1392
P
13COEFFICIENT.1 InitialPosition
14COEFFICIENT.2 InitialSpeed
15COEFFICIENT.3 SpringForce
16COEFFICIENT.4 Damping # linear to speed
17COEFFICIENT.5 Mass # 1 / mass
2faffece
P
18
19PROGRAM DIVISION
20# Colors being used for wiring
21# - black: y0
22# - blue: y0’
23# - green: y0’’
24# - yellow: y’’, y’
25# - red: y
6e8a1392
P
26-1 -> COEFFICIENT.InitialPosition -> -y0 # -initial position of the mass
27-1 -> COEFFICIENT.InitialSpeed -> y0s’ # y’ is scaled to be within -1..+1
28+1, y0s’, y0s’ -> SUMMER -> y0’
29y’’, IC:y0’ -> INTEGRATOR -> -y’
30-y’,IC:-y0 -> INTEGRATOR -> y
31y -> COEFFICIENT.SpringForce -> S*y # springforce times displacement
32-y’ -> INVERTER -> y’
33y’ -> COEFFICIENT.Damping -> D*y’ # damping times speed
34S*y, D*y’ -> SUMMER -> -(Dy’+Sy)
35-(Dy’+Sy) -> COEFFICIENT.Mass -> -1/m*(Dy’+Sy)=y’’
2faffece
P
36
37OPERATION DIVISION
38MODE REPEAT
39OP-TIME 80ms